package com.flipdf2.serialize.ppml.element;

import org.jdom.Element;
import org.jdom.Namespace;

import com.flipdf2.serialize.ppml.PPMLException;
import com.flipdf2.serialize.ppml.PPMLConstant.PPMLEncoding;

public class PPMLInternalData {
	public static final String NAME = "INTERNAL_DATA";
	
	private String data;
	
	private String encoding = PPMLEncoding.NONE;
	private String characterSet;
	private String creator;
	private String label;
	
	public Element toXML(Namespace defaultNamespace) {
		Element root = null;
		if (defaultNamespace != null) {
			root = new Element(NAME, defaultNamespace);
		} else {
			root = new Element(NAME);	
		}
		
		if (data != null && data.length() > 0)
			root.setText(data);
		if (encoding != null) 
			root.setAttribute("Encoding", encoding);
		if (characterSet != null) 
			root.setAttribute("CharacterSet", characterSet);
		if (creator != null) 
			root.setAttribute("Creator", creator);
		if (label != null) 
			root.setAttribute("Label", label);
		
		return root;
	}
	
	public void check() throws PPMLException {
		
	}

	public String getCharacterSet() {
		return characterSet;
	}


	public void setCharacterSet(String characterSet) {
		this.characterSet = characterSet;
	}


	public String getCreator() {
		return creator;
	}


	public void setCreator(String creator) {
		this.creator = creator;
	}


	public String getData() {
		return data;
	}


	public void setData(String data) {
		this.data = data;
	}


	public String getEncoding() {
		return encoding;
	}


	public void setEncoding(String encoding) {
		this.encoding = encoding;
	}


	public String getLabel() {
		return label;
	}


	public void setLabel(String label) {
		this.label = label;
	}
}
